package com.workday.gridsimulator

import akka.actor._



/* Messages sent to actors should always be immutable to avoid sharing mutable state and ensure they are thread safe.
 * Case classes make excellent messages:
 * 		-->Case classes can be pattern matched
        -->Case classes automatically define hashcode and equals
        -->Case classes automatically define getter methods for the constructor arguments.
        -->Case classes are immutable unless you specifically add var fields, or the val fields are mutable
 * Put all case classes in the SimulationProcess trait to make available to all actors for possible use
 * Use the sealed trait GridMessage so any subclass of this must be declared in the same file 
 */


//need a proper place for these....
//to do- check best practices

case class CreateWorkers(count:Int, instanceType:Ec2Instance)
case class WorkerRegistration(worker: Worker)
case class AllocatedWork(currentTime: Double, work:Work)
case class Hold(arrivalTime: Double, actorRef: ActorRef)
case class WorkSubmission(currentTime: Double, worker:Work) 
case class WorkItem(time: Double, actor: ActorRef)
case class WorkCompleted(currentTime: Double, work: Work, worker:Worker) 
case class WorkArrivalFinished(currentTime: Double) 
case class Stop(currentTime: Double) 

case class Finished(actorRef: ActorRef)
case class SimFinished(result:String, cost:String)
case class Ping(currentTime: Double) 
case class Start(currentTime: Double) 
case class NoMoreWork(currentTime: Double)
case class WorkerCost(workerCost: Double, currentTime: Double)

case class AddMe(actorRef: ActorRef)
case class FreeWorkerCount
case class AllWorkerCount
case class WorkSubmittedCount
case class WorkCompletedCount
case class WhatTimeIsIt
case class IsClockRunning

case class WorkingOnWhat
case class WorkRemaining
case class SendStatusUpdate(actor:ActorRef)
case class StartSim(args: Array[String])
case class SimulationStatus(submittedWorkCount:Int, workCompletedCount:Int, currentTime:String, workerCount:Int)
case class IamTheGrid
case class RegisterWithGrid

case class Msg(txt:String)
case class RegMeForUpdates(actor:ActorRef, updateMeAfterThisManyCompletions: Int)
case class Pong(time:Double)
case class CarryOn
case class ActorCount
case class UserSaidStop
case class UserSaidAddWorker
case class UserSaidRemoveWorker
case class UserSaidIncrementArrivalRate
case class UserSaidDecrementArrivalRate
case class SetSchedulerWork(work: Seq[Work], initialArrivalRate: Int)
case class NextScheduleTime()
case class WorkAllocatedCount()